AttrDef related questions?

My first question was: 

  1. What  if (!ad.object)  continue     // This attr isn't for objects  (e.g. "Prefix")
    ad.object
    means?
  2. What ad.dxl means?
  3. But when writing this post other questions related to AttrDef appears, so I want to ask for them here in one post:
    Properties are defined for use with the . (dot) operator and an attribute definition handle to extract information from an attribute definition, as shown in the following syntax: (AttrDef ad).property

    AttrDef ad = create object type "Integer" attribute "cost"
    ad = modify(ad, object type "Integer" attribute "Costing")
    ad = modify(ad, setHistory, true)
    ad = modify(ad, setDefault, "123")
    ad = modify(ad, setURI, "http://www.webaddress.com")


    Module m = current AttrDef ad = find(m, "AttrName")
    Then \i find in the DXL guide:
    ModuleProperties is a new data type representing the properties of a module. It consists of type definitions, attribute definitions, and module attribute values. As with object and module types the . (dot) operator can be used to extract attribute value
    Do does it means that we have module properties and beside that we have object properties?
  4. What kind of attributes exists? Object, module, these which use can assess?
  5. Why we can not extract the url with ad.url or ad.description? How to distinguish this kind of attributes when iterating over the attributes in one module?

// only interested in object attributes
            if (ad.object)
            {
                // exclude system attributes
                if (ad.system) continue

                // exclude DXL attributes
                adDxl = ad.dxl

                if (adDxl "" != "") continue


Dinio - Sat Dec 26 11:04:30 EST 2015

Re: AttrDef related questions?
Costas..Aravidis - Sun Dec 27 15:18:10 EST 2015

Hi Dinio,

You will find that the answers to all or most of your questions are in the dxl manual that can be found either in doors or in the Internet on the IBM Documentation.

http://www-01.ibm.com/support/knowledgecenter/SSYQBZ_9.6.1/com.ibm.doors.requirements.doc/topics/dxl_reference_manual.pdf?lang=en-us

 

Costas

 

Re: AttrDef related questions?
Mike.Scharnow - Sun Dec 27 16:30:44 EST 2015

1.+4. I agree that it's easy to get confused. An AttrDef is what you see when you open the dialog Edit -> Types in a module. An attribute (or AttrDef) can exist for every object, for the module itself or both. if the property ad.object evaluates to "true", then the current AttrDef is for objects, and for every object you will have this attribute.

 

2. either "DXL text of an attribute that uses DXL attribute. " or "Whether the attribute definition is for an attribute that has its value generated by DXL.", depending on whether you store the result to a string or bool variable.

 

3. A ModuleProperties is more or less what you see when you open the dialog File -> ModuleProperties. The big advantage of using ModuleProperties is that module properties can be read from a module without having to open it - this is faster when you have big modules. There are some overlaps, for example

  • the loop "for AttrType in ModuleProperties" will bring the same result as the loop "for AttrType in Module".
  • And module attributes can either be accessed by the loop "for string in ModuleProperties" or e.g. by "string sCreator = mod."Created By" """.
  • Attribute Definitions can be retrieved either by the perm "AttrDef find (Module, string)" or by the perm "AttrDef find (ModuleProperties, string)"

5. Questions beginning with "Why" often cannot be answered for DOORS - usually nobody has an idea why the developers chose this or that way how to get an information. URLs can be retrieved with the perm getURL. Note that an AttrDef has no URL. Only Databases, Modules, ModName_ ModuleVersions, Objects, Folders, Projects and Items have URLs. Why would you want to get the URL of an AttrDef?

Concerning your last question ("How to distinguish"), just in case I have not explained it well: you have to distinguish the concept of attribute definitions and of attributes. An AttrDef defines that an attribute exists, it contains the information which type the attribute has. The attribute itself contains the value. So, you can either iterate over the attributes or over the attribute definitions.

Re: AttrDef related questions?
Dinio - Mon Dec 28 03:27:46 EST 2015

Mike.Scharnow - Sun Dec 27 16:30:44 EST 2015

1.+4. I agree that it's easy to get confused. An AttrDef is what you see when you open the dialog Edit -> Types in a module. An attribute (or AttrDef) can exist for every object, for the module itself or both. if the property ad.object evaluates to "true", then the current AttrDef is for objects, and for every object you will have this attribute.

 

2. either "DXL text of an attribute that uses DXL attribute. " or "Whether the attribute definition is for an attribute that has its value generated by DXL.", depending on whether you store the result to a string or bool variable.

 

3. A ModuleProperties is more or less what you see when you open the dialog File -> ModuleProperties. The big advantage of using ModuleProperties is that module properties can be read from a module without having to open it - this is faster when you have big modules. There are some overlaps, for example

  • the loop "for AttrType in ModuleProperties" will bring the same result as the loop "for AttrType in Module".
  • And module attributes can either be accessed by the loop "for string in ModuleProperties" or e.g. by "string sCreator = mod."Created By" """.
  • Attribute Definitions can be retrieved either by the perm "AttrDef find (Module, string)" or by the perm "AttrDef find (ModuleProperties, string)"

5. Questions beginning with "Why" often cannot be answered for DOORS - usually nobody has an idea why the developers chose this or that way how to get an information. URLs can be retrieved with the perm getURL. Note that an AttrDef has no URL. Only Databases, Modules, ModName_ ModuleVersions, Objects, Folders, Projects and Items have URLs. Why would you want to get the URL of an AttrDef?

Concerning your last question ("How to distinguish"), just in case I have not explained it well: you have to distinguish the concept of attribute definitions and of attributes. An AttrDef defines that an attribute exists, it contains the information which type the attribute has. The attribute itself contains the value. So, you can either iterate over the attributes or over the attribute definitions.

BIG thakns,@Mark.Scharnow, for the answer, but I have couple of question that comes from it. Sorry for that I am new to DXL but I want to clear the main concepts:

  1. So AttrDef and attributes can exists for object, module or both? So if we have attribute only for module ad.module will return true and ad.object will return false?
  2. AttrDef contains information for the attribute - if exists, its type, name,description, uri but  the pure value is not part of the AttrDef. The value is in the attribute?
  3. For ad.dxl I saw in the manual that we have two forms one when store the result in bool and one in string but can not understand the signification of that? So from my understanding when ad.dxl is true that means that the attribute value is generated by DXL and when is false that means that some user for example enter that value? Is that the purpose of that property?

Re: AttrDef related questions?
Mike.Scharnow - Mon Dec 28 04:59:50 EST 2015

Dinio - Mon Dec 28 03:27:46 EST 2015

BIG thakns,@Mark.Scharnow, for the answer, but I have couple of question that comes from it. Sorry for that I am new to DXL but I want to clear the main concepts:

  1. So AttrDef and attributes can exists for object, module or both? So if we have attribute only for module ad.module will return true and ad.object will return false?
  2. AttrDef contains information for the attribute - if exists, its type, name,description, uri but  the pure value is not part of the AttrDef. The value is in the attribute?
  3. For ad.dxl I saw in the manual that we have two forms one when store the result in bool and one in string but can not understand the signification of that? So from my understanding when ad.dxl is true that means that the attribute value is generated by DXL and when is false that means that some user for example enter that value? Is that the purpose of that property?

Thanks, Dinio.

I understand that you are new to DXL, but permit the question: Are you aware that it is mandatory to have good experience as DOORS administrator to be able to program DXL? I would say that you need to work for half a year as administrator, including responsibility for the data model before you start even thinking about programming DXL. You need to have experience with the DOORS GUI and everything that changes when you click somewhere. Otherwise it is too easy to confuse DOORS terms and to mess up the contents of your Database. If you already have this experience, then programming DXL is more or less about finding the correct command for each GUI element (at least in programs concerning data model definition) .

Concerning your questions, you are right in all questions.

1: asking DOORS for ad.module and ad.object are nothing more or less than "looking at" the area "Attribute Scope" in Module Editor -> Edit -> Attributes -> double click:

Attribute Scope

2. Yes. You can also see the difference in the GUI: The definition of the attribute is in Module Editor -> Edit -> Attributes (even including the default value if there is one), and the content of the attribute is in Module Editor -> File -> Module Properties.

3. Yes. Again, its all in the GUI. Look at the screen shot:

ad.dxl bool and string

the code "bool bIsItADXLAttribute = ad.dxl" will tell you whether the check box will be on or off (green), So, Yes, you are right again.

the code "string strDXLCode = ad.dxl" will give you the content of Browse -> Current (red), so it will give you (or set) the DXL code itself.

 

 

Re: AttrDef related questions?
Dinio - Mon Dec 28 06:42:31 EST 2015

Again BIG thanks. Now when you said I will pay attention on the GUI. THanks !!!!